/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.hibernate.annotations.Cascade;

/**
 *
 * @author Achie
 */
@Entity
@Table(name = "Course")
public class Course implements Serializable {

    @Id
    @GeneratedValue
    @Column(name = "id")    
    private long id;
    @Column(name = "name")
    private String name;
    @Column(name = "price")
    private double price;
    @Column(name = "currency")
    private String currency;
    @Column(name = "description")
    private String description;
    @ManyToOne    
    private Category category;
    @ManyToMany
    @JoinTable(name = "course_teacher")
    private Set<Employee> teacher;
    @ManyToMany
    @JoinTable(name = "course_student")
    private Set<Student> student;
    @Column(name = "added_on")
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date date;

    public Course() {
    }

    public Course(long id, String name, String description, double price, String currency, Category category) {
        this.setId(id);
        this.setName(name);
        this.setPrice(price);
        this.setDescription(description);
        this.setCategory(category);
        this.setCurrency(currency);
        this.setDate();
    }

    /**
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the price
     */
    public double getPrice() {
        return price;
    }

    /**
     * @param price the price to set
     */
    public void setPrice(double price) {
        this.price = price;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the category
     */
    public Category getCategory() {
        return category;
    }

    /**
     * @param category the category to set
     */
    public void setCategory(Category category) {
        this.category = category;
    }

    /**
     * @return the teacher
     */
    public Set<Employee> getTeacher() {
        return teacher;
    }

    /**
     * @param teacher the teacher to set
     */
    public void setTeacher(Set<Employee> teacher) {
        this.teacher = teacher;
    }

    /**
     * @return the currency
     */
    public String getCurrency() {
        return currency;
    }

    /**
     * @param currency the currency to set
     */
    public void setCurrency(String currency) {
        this.currency = currency;
    }

    /**
     * @param EnroledStudent the EnroledStudent to get
     */
    public Set<Student> getStudent() {
        return student;
    }

    /**
     * @param EnroledStudent the EnroledStudent to set
     */
    public void setStudent(Set<Student> student) {
        this.student = student;
    }

    /**
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * @param date the date to set
     */
    public void setDate() {
         Date date = new Date();
        this.date = date;
    }
}
